package appapi.Vo;

import appapi.entity.auth.RoleEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import org.springframework.beans.BeanUtils;

import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 添加角色请求对象
 *
 * @author luocheng
 * @version 1.0
 * @date 2023/05/18 14:20
 */
@ApiModel
@Data
@NoArgsConstructor
@Accessors(chain = true)
public class AddRoleVo implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "角色名称",required = true)
    @NotNull(message = "角色名称不能为空")
    @Length(max = 20, message = "角色名称不能超过20个字符,请确认.")
    private String roleName;

    @ApiModelProperty(value = "角色编码",required = true)
    @NotNull(message = "角色编码不能为空")
    @Length(max = 10, message = "角色编码不能超过1个字符,请确认.")
    private String roleCode;

    @ApiModelProperty(value = "角色状态：0-使用;1-停用;2-删除",required = true)
    @NotNull(message = "角色状态不能为空")
    private Integer roleState;

    @ApiModelProperty(value = "0是/1否",required = true)
    @NotNull(message = "是否预置不能为空")
    private Integer isPreset;

    @ApiModelProperty(value = "备注说明")
    private String roleNote;

    public RoleEntity vo2Entity(){
        RoleEntity entity = new RoleEntity();
        BeanUtils.copyProperties(this,entity);
        return entity;
    }
}
